import { feachList } from '@/api/tag'

const state = {
  tagOptions: []
}

const mutations = {
  SET_TAG_OPTIONS: (state, list) => {
    state.tagOptions = list
  }
}

const actions = {
  getTagList({ commit }) {
    return new Promise((resolve, reject) => {
      feachList(
        {
          page: 1,
          limit: 100
        }
      ).then((response) => {
        const { result } = response
        commit('SET_TAG_OPTIONS', result.list)
        resolve()
      }).catch((error) => {
        reject(error)
      })
    })
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
